package com.cwm.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class SendMsgController {
    @Autowired
    private ProducerService producerService;

    // 发送消息方式三，
    @GetMapping("send2")
    public String send2() {
        String serial = UUID.randomUUID().toString();
        // 创建并发送消息
        System.out.println("***生产: " + serial);
        // 第一个参数就是bindingName，就是application当中配置的通道名称，第二个参数就是消息
        producerService.sendMsg(serial);
        return serial;
    }

}
